Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
larvitutils
Advanced tools
Misc utilities
const utils = require('larvitutils'),
uuid = utils.formatUuid(new Buffer('f9684592b24542fa88c69f16b9236ac3', 'hex'));
console.log(uuid); // f9684592-b245-42fa-88c6-9f16b9236ac3
Example usecase: fetch a binary column from a database and convert to a readable Uuid string
const utils = require('larvitutils'),
uuid = utils.formatUuid(' f9684592b24542fa88c69f16b9236ac3'); // Notice the starting space getting trimmed away
console.log(uuid); // f9684592-b245-42fa-88c6-9f16b9236ac3
Used to convert hrtime() calls to milliseconds, since hrtime() output is messy (seconrds + nanoseconrds)
Usage:
const utils = require('larvitutils'),
startTime = process.hrtime();
setTimeout(function() {
console.log('benchmark took %d ms', utils.hrtimeToMs(startTime, 4));
// benchmark took 34.0005 ms
}, 34);
const utils = require('larvitutils'),
uuidStr = 'f9684592-b245-42fa-88c6-9f16b9236ac3';
utils.uuidToBuffer(uuidStr); // Will return a buffer or false on failure
const utils = require('larvitutils'),
str = 'f9684592-b245-42fa-88c6-9f16b9236ac3';
utils.replaceAll('-', '_', str); // f9684592_b245_42fa_88c6_9f16b9236ac3
const utils = require('larvitutils'),
validUuid = 'f9684592-b245-42fa-88c6-9f16b9236ac3',
invalidUuid1 = false,
invalidUuid2 = 'foobar',
invalidUuid3 = {'höhö': 'oveboll'};
utils.formatUuid(validUuid); // true
utils.formatUuid(invalidUuid1); // false
utils.formatUuid(invalidUuid2); // false
utils.formatUuid(invalidUuid3); // false
const utils = require('larvitutils');
utils.isInt(10); // true
utils.isInt(10.0); // true
utils.isInt(10.5); // false
utils.isInt('oveboll'); // false
Just a very simple object intended to keep instances of objects across moduels.
file 1:
const utils = require('larvitutils');
let foo;
function Foo() {}
foo = new Foo();
foo.bar = 'baz';
utils.instances.foo = foo;
file 2:
const utils = require('larvitutils'),
foo = utils.instances.foo;
console.log(foo.bar); // 'baz'
FAQs
Misc utils
We found that larvitutils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.